<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/axios/1.2.1/axios.js"></script>
</head>

<body>
    <button>发送请求</button>
    <script>
        // 获取按钮
        let btns = document.querySelectorAll('button');

        //定义2个axios调用 
        btns[0].onclick =async function(){

            let a1 = axios('http://localhost:3000/students');
            let a2 = axios('https://v1.hitokoto.cn/?c=a');

            // console.log(a1);
            // console.log(a2);
            let [{data:data1},{data:data2}] =await axios.all([a1,a2]);

            console.log(data1);
            console.log(data2);
        
        }

        // 监听2个axios执行结果及定义回调
        
    </script>
</body>

</html>